<!DOCTYPE html>
<html class="x-admin-sm">

<head>
    <meta charset="UTF-8">
    <title>欢迎页面-X-admin2.2</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <script type="text/javascript" src="../../common/js/public.js"></script>
    <script type="text/javascript" src="../../common/js/publicUtils.js"></script>
    <style>
        .layui-input-inline,.buttondiv .layui-input-inline {
            float: left;
            width: 450px !important;
            margin-right: 10px;
        }
        .error{
            color: red;
            line-height: 20px;
        }
        .uploadtemp{
            font-size: 14px;
            line-height: 35px;
        }
        #errormsg{
            line-height: 40px;
            font-size: 16px;
            text-align: center;
        }
    </style>
</head>
<body>
<div class="layui-fluid">
    <div class="layui-row">
        <p class="uploadtemp">第一步：下载导入模板，<a href="../../filedown/人员导入模板.xlsx" style="color:#EB1112">点击下载</a></p>
        <p class="uploadtemp">第二步：选择需要导入的excel文件，导入的excel文件必须按模板填写</p>
        <div class="layui-upload">
            <button type="button" class="layui-btn layui-btn-normal" id="select">选择文件</button>
        </div>
        <p class="uploadtemp">第三步：点击导入按钮导入文件，点击取消按钮侧关闭页面</p>
        <div>
            <button type="button" class="layui-btn" id="upload">开始上传</button>
        </div>
        <p id="errormsg"></p>
    </div>
</div>
<script>
    var nodes;
   $(function(){

   })

    function getOrgId(orgId){
        layui.use('upload', function() {
            var $ = layui.jquery
                , upload = layui.upload;
            // var index=layer.load(1, {shade: [0.4, '#A9A9A9']});
            //选完文件后不自动上传
            upload.render({
                elem: '#select'
                ,url: publicUrl+'/orgPerson/uploadFile'
                ,auto: false
                //,multiple: true
                ,bindAction: '#upload'
                ,accept: 'file'
                ,exts:'xls|xlsx'//那么，就只会支持这三种格式的上传。注意是用|分割
                ,data: {"orgId":orgId} //可选项。额外的参数，如：{id: 123, abc: 'xxx'}
                ,headers:{
                    "Authorization":getData("Authorization")
                }
                ,before:function(obj){
                    layer.load(1, {shade: [0.4, '#A9A9A9']});
                }
                ,done: function(res){
                    layer.closeAll('loading');
                    if(res.code==2000){
                        if(res.data.flag==true){
                            $("#errormsg").html("<span style='color: #00ee00'>导入成功！</span>");
                            loadTable();
                        }else{
                            $("#errormsg").html("<span style='color: red'><a style='color: red' href="+publicUrl+"common/download/downErrorFile?filename="+res.data.filecode+"&errorname=人员导入错误文件'>导入失败，点击下载错误文件！</a></span>")
                        }
                    }else{
                        $("#errormsg").html("<span style='color: red'>未知错误，导入失败！</span>");
                    }
                }
            });
        })
    }

    function loadTable(){
        var _parentWin = window.opener;
        window.parent.reloadTable();
    }


</script>
</body>

</html>
